package io;

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class FlushDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos=new FileOutputStream("fos.txt");
        BufferedOutputStream bos=new BufferedOutputStream(fos);
        String str="让我在看你一次";
        byte[]date=str.getBytes(StandardCharsets.UTF_8);
        bos.write(date);//数据没缓冲满之前不会主动写出
        //bos.flush();//强制将bos缓存的数据写出
        System.out.println("数据写出完毕");
        bos.close();

    }
}
